<?php

namespace App\Http\Controllers\Auth;

use App\Http\Common\Globals;
use App\Http\Common\Sms;
use App\Http\Controllers\BaseController;
use App\Http\Requests\Admin\LoginRequest;
use App\Models\Front\User;

/**
 * 手机登录
 * Class PhoneLoginController
 * @package App\Http\Controllers\Auth
 */
class PhoneLoginController extends BaseController
{
    public function __construct()
    {
        parent::__construct();
        $this->model = new User();
    }

    /**
     * 前端小程序用户 登录调用的接口
     * @param LoginRequest $request
     * @return string
     */
    public function login(LoginRequest $request){
        Sms::getInstance()->sendMessageCodeOne();
        Globals::$error = '';
        // 获取openID unionId之类
        // 登录，利用用户名称以及密码来进行登录
        $this->model->login($request->all());
        return $this->dealData();
    }
}
